package org.jeecg.modules.basicGoods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.basicGoods.entity.BasicGoods;
import org.jeecg.modules.basicGoods.mapper.BasicGoodsMapper;
import org.jeecg.modules.basicGoods.service.IBasicGoodsService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description: 货物名称信息
 * @Author: jeecg-boot
 * @Date:   2024-08-14
 * @Version: V1.0
 */
@Service
public class BasicGoodsServiceImpl extends ServiceImpl<BasicGoodsMapper, BasicGoods> implements IBasicGoodsService {

    @Override
    public List<String> getDeliveryGoods() {
        LambdaQueryWrapper<BasicGoods> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(BasicGoods::getTransportStatus, 1);
        List<BasicGoods> list = this.list(wrapper);
        return list.stream().map(BasicGoods::getGoods).collect(Collectors.toList());
    }

    @Override
    public List<String> getTakeGoods() {
        LambdaQueryWrapper<BasicGoods> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(BasicGoods::getTransportStatus, 0);
        List<BasicGoods> list = this.list(wrapper);
        return list.stream().map(BasicGoods::getGoods).collect(Collectors.toList());
    }
}
